package edu.buaa.act.travel.m.tpdl.moveaction;

import org.json.JSONException;
import org.json.JSONObject;

import edu.buaa.act.travel.m.tpdl.JSONable;

public class MoveAction implements JSONable{
	String startPlace;
	String endPlace;
	
	protected JSONObject toJSONObject(){
		JSONObject o = new JSONObject();
		try {
			o.put("startPlace", startPlace);
			o.put("endPlace", endPlace);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return o;
	}
	
	@Override
	public void fromJSON(JSONObject j) throws JSONException {
		this.setStartPlace(j.getString("startPlace"));
		this.setEndPlace(j.getString("endPlace"));
	}
	@Override
	public String toJSONString() {
		return toJSONObject().toString();
	}
	
	public String getStartPlace() {
		return startPlace;
	}
	public void setStartPlace(String startPlace) {
		this.startPlace = startPlace;
	}
	public String getEndPlace() {
		return endPlace;
	}
	public void setEndPlace(String endPlace) {
		this.endPlace = endPlace;
	}
}
